home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
26
/
3
/
DISK2631.ZIP
/
EXAMP1.ZIP
/
RMEX122.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-04-17
|
967b
|
32 lines
'Reference Manual Example, Page 122.
'
'*************************************************************
$LIB ALL OFF
$ERROR ALL OFF
CLS
'open a random-access file
OPEN "R", #1,"CVISLD.DTA",18
'make two field defintions for each field
FIELD #1, 2 AS IntegerVar$, 4 AS LongIntVar$,_
4 AS SinglePreVar$, 8 AS DoublePreVar$
FIELD #1, 2 AS A$, 4 AS B$, 4 AS C$, 8 AS D$
MaxInt% = 32767
'write some data to the file
FOR I% = 1 TO 5
'convert the data and assign it to the
'buffer before writing it to the data file
LSET IntegerVar$ = MKI$(I%)
LSET LongIntVar$ = MKL$(I% + CLNG(MaxInt%))
LSET SinglePreVar$ = MKS$(I% * CSNG(MaxInt%))
LSET DoublePreVar$ = MKD$(MaxInt%^I%)
PUT #1,I%
NEXT I%
FOR I% = 1 TO 5 'read data from file
GET #1, I% 'display it onscreen
PRINT CVI(A$); CVL(B$); CVS(C$); CVD(D$)
NEXT I%
CLOSE #1 'close the file
END 'end the program